package cn.stylefeng.guns.modular.auth.service.impl;

import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.stylefeng.guns.modular.auth.mapper.AuthAccountPriorityRelationshipMapper;
import java.util.List;
import java.util.Optional;

import cn.stylefeng.guns.modular.auth.entity.AuthAccountPriorityRelationshipEntity;
import cn.stylefeng.guns.modular.auth.service.AuthAccountPriorityRelationshipService;

/**
 * @author allen
 * @date 2021/4/12 10:07
 * @version 1.0
 */
@Service
public class AuthAccountPriorityRelationshipServiceImpl extends ServiceImpl<AuthAccountPriorityRelationshipMapper, AuthAccountPriorityRelationshipEntity> implements AuthAccountPriorityRelationshipService{

    @Override
    public int updateBatch(List<AuthAccountPriorityRelationshipEntity> list) {
        return baseMapper.updateBatch(list);
    }
    @Override
    public int updateBatchSelective(List<AuthAccountPriorityRelationshipEntity> list) {
        return baseMapper.updateBatchSelective(list);
    }
    @Override
    public int batchInsert(List<AuthAccountPriorityRelationshipEntity> list) {
        return baseMapper.batchInsert(list);
    }
    @Override
    public int insertOrUpdate(AuthAccountPriorityRelationshipEntity record) {
        return baseMapper.insertOrUpdate(record);
    }
    @Override
    public int insertOrUpdateSelective(AuthAccountPriorityRelationshipEntity record) {
        return baseMapper.insertOrUpdateSelective(record);
    }

    @Override
    public Boolean existRecordByPriorityId(Long priority) {

        Optional<AuthAccountPriorityRelationshipEntity> authAccountPriorityRelationshipEntity =
                this.lambdaQuery()
                        .eq(AuthAccountPriorityRelationshipEntity::getPriorityId, priority).oneOpt();
        return authAccountPriorityRelationshipEntity.isPresent();
    }
}
